home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / lmwrap / ogl / draw.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  2.3 KB  |  80 lines

  1. /*
  2.  * Copyright (c) 1995, Silicon Graphics, Inc.
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that the name of Silicon Graphics may not be used in any advertising or
  7.  * publicity relating to the software without the specific, prior written
  8.  * permission of Silicon Graphics.
  9.  *
  10.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  11.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  12.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  13.  *
  14.  * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  15.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
  16.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
  17.  * POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
  18.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19.  *
  20.  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  21.  */
  22. /*----------------------------------------------------------------------------
  23.  *
  24.  * file   : draw.c 
  25.  *
  26.  * Author : Yusuf Attarwala
  27.  * Date   : Apr 95
  28.  *
  29.  *---------------------------------------------------------------------------*/
  30. #include <math.h>
  31. #include <stdio.h>
  32. #include <gl/device.h>
  33. #include <sys/types.h>
  34. #include <sys/times.h>
  35. #include <sys/param.h>
  36.  
  37.  
  38. #include "globals.h"
  39. #include "lm.h"
  40.  
  41. /* irisGL style lmbind will call our lmbind */
  42.  
  43.  
  44. void
  45. drawScene()
  46. {
  47.  
  48.  
  49.     GLwDrawingAreaMakeCurrent(glw, glxc);
  50.  
  51.     lmbind(LMODEL,curLModel);
  52.  
  53.     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  54.  
  55.     glEnable(GL_LIGHTING);
  56.     glPushMatrix();
  57.     glRotatef(anglex,1.0,0.0,0.0);
  58.     glRotatef(angley,0.0,1.0,0.0);
  59.     glRotatef(anglez,0.0,0.0,1.0);
  60.     gluQuadricDrawStyle (quadObj, GLU_FILL);
  61.     glTranslatef(0.2,0.2,0.2);
  62.     lmbind(MATERIAL,curMatSet);
  63.     if (curLModel == LTM_INF_TWO) lmbind(BACKMATERIAL,curMatSet+1);
  64.     gluSphere(quadObj,3.0,15,15);
  65.     glTranslatef(3.2,3.2,0.0);
  66.     lmbind(MATERIAL,curMatSet+1);
  67.     if (curLModel == LTM_INF_TWO) lmbind(BACKMATERIAL,curMatSet);
  68.     gluSphere(quadObj,3.0,15,15);
  69.  
  70.     glPopMatrix();
  71.     glFlush();
  72.     glDisable(GL_LIGHTING);
  73.  
  74.     lmbind(LMODEL,0);
  75.  
  76.     if (doubleBuffer) glXSwapBuffers(XtDisplay(glw), XtWindow(glw));
  77.  
  78. }
  79.  
  80.